package homework.score;

import homework.score.util.FieldName;

public class Student {

    private String id;

    @FieldName("姓名")
    private String name;

    @FieldName("年龄")
    private int age;

    public Student(String id) {
        this.id = id;
    }

    public Student(String code, String name) {
        this.id = code;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public int hashCode() {
        return getId().hashCode();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }

        if (o == this) {
            return true;
        }

        if (o.getClass() != getClass()) {
            return false;
        }

        Student other = (Student) o;

        return other.getId().equals(getId());
    }
}
